﻿import {getCookie} from '@/utils/commonUtils'

const PRODUCT_URL = 'http://10.128.86.73:28001/nppm-service';
const TEST_URL = 'http://10.128.90.198:8091/nppm-service'
// const DEV_URL = 'http://10.128.90.198:8091/nppm-service';
const DEV_URL = 'http://localhost:8091/nppm-service';

let ENVIRONMENT = ""

const CURRENT_URL = function(){
    if (process.env.NODE_ENV === 'development') {
        ENVIRONMENT = 'development'
        return DEV_URL;
    } else if(getCookie('env') == 'test'){//测试
        ENVIRONMENT = 'test'
        return TEST_URL;
    } else if(getCookie('env') == 'gate'){//演示
        ENVIRONMENT = 'gate'
        return "http://10.128.28.59:21604/nppm-service";
    }else {//生产
        ENVIRONMENT = 'product'
        return PRODUCT_URL;
    }
}();


const WEBPREFIX = "../nppm-web/proxy";

const BIG_DATA_URL = function(){
    return "http://10.128.28.6:21601";
}();

const OPEN_API_SERVER = function(){
    if (process.env.NODE_ENV === 'development') {
        return "http://10.128.90.198:8070";
    } else if(getCookie('env') == 'test'){//测试
        return "http://10.128.90.198:8070";
    } else if(getCookie('env') == 'gate'){//演示
        return "http://10.128.28.6:21601";
    }else {//生产
        return "http://10.128.28.6:21601";
    }
}();

const PREFIX = "/apis/v1";

const NODE_SERVER_URL = function(){
    if (process.env.NODE_ENV === 'development') {
        return "http://localhost:18360";
    } else if(getCookie('env') == 'test'){//测试
        return "http://10.128.90.198:18360";
    } else if(getCookie('env') == 'gate'){//演示
        return "http://10.128.28.59:18360";
    }else {//生产
        return "http://10.128.28.59:18360";
    }
}();

const URLS = {
	API_ACCTITEM_TYPE : PREFIX + "/ai/getAcctItemType",//账目项列表
    API_ADD_TYPE : PREFIX + "/ai/addAcctItemType",// 新增账目项
    API_EDIT_TYPE : PREFIX + "/ai/updateAcctItemType",// 编辑账目项
    API_STOP_TYPE : PREFIX + "/ai/stopAcctItemType",// 停用账目项
    API_TYPE_CODE : PREFIX + "/ai/getTypeCode",// 账目项编码，后端生成
    API_ACCTITEM_GROUP : PREFIX + "/ai/getAcctItemGroup",//账目项目录
    API_ADD_GROUP : PREFIX + "/ai/addAcctItemGroup",// 新增账目项目录
    APR_REMOVE_GROUP : PREFIX + "/ai/removeAcctItemGroup",// 删除账目项目录
    API_ACCTITEM_TYPE_GROUP: PREFIX + "/ai/getAcctItemTypeAndGroup",//账目项和账目组
	
    API_PPM_LOGIN: CURRENT_URL+ PREFIX + "/ppm",//获取ppm菜单重定向

    API_WHITELIST_ADD: PREFIX + "/addWhiteList",//录入白名单
    API_WHITELIST_REMOVE: PREFIX + "/removeWhiteList",//删除白名单
    API_WHITELIST_EDIT: PREFIX + "/editWhiteList",//修改白名单
    API_WHITE_LIST: PREFIX +"/queryWhiteList",//白名单查询
    API_WHITELIST_EXPORT: PREFIX +"/excel/download",//导出白名单
    API_WHITELIST_BATCHREMOVE: PREFIX +"/batchRemoveWhiteList",//批量删除白名单
    API_QRY_STAFF_LIST: PREFIX +"/jt/staffs",//查询联系人
    API_QRY_PRODUCT_LIST: PREFIX +"/queryProduct",//查询集团产品
    API_MENU: PREFIX +"/menus/0",

    API_DEMAND_ORDER_ID: PREFIX + "/busiOrderIds",//生成busiOrderId
    API_ORDER_LIST: PREFIX + "/configOrders",//查需求单列表
    API_DEMAND_TEMPLATE:　PREFIX + "/demands/{busiTemplateId}/templates",//需求单模板
    API_SAVE_TEMPLATE: PREFIX + "/templates",//保存模板组件过程数据
    API_GET_TEMPLATE_DATA: PREFIX + "/templateInfos",//查模板组件过程数据
    API_GET_INST_DATA: PREFIX + "/jt/qryTrafficIdentifyInst",//查流量标识实例数据
    API_ORDER_PUBLISH : PREFIX + "/demands/{busiOrderId}/processes",
    API_ORDER_PUBLISH_STAFF : PREFIX + "/taches-operators",

    API_ORDER_EXPIRE: PREFIX + "/voidOrder",//作废订单

    API_TAR_LABEL_GRP:  PREFIX + "/jt/tarLabelGrp",//查询注智标签目录
    API_TAR_LABEL_LIST:   PREFIX + "/jt/tarLabel",//查询注智标签


    API_CATALOG:   PREFIX + "/jt/catalogs",//查询销售品目录
    API_OFFER_LIST: PREFIX + "/jt/queryOfferView", //查销售品


    API_REGIONS: PREFIX  + "/jt/queryRegions",
    API_CHANNEL_TYPE: PREFIX  + "/jt/channel",
    API_CHANNEL_LIST: PREFIX  + "/jt/channelList",
    API_CHANNEL_GRP: PREFIX  + "/jt/channelGrp",
    API_CHANNEL_GRP_LIST: PREFIX  + "/jt/channelGrpList",

    API_CHANNEL_SCRIPT: PREFIX + "/jt/channelScript",
    API_CHANNEL_SAVE_SCRIPT: PREFIX + "/jt/saveChannelScript",

    
    API_EVENT_CATALOG : PREFIX + "/jt/serviceEvent/qryMktCampaignTypeCatalog",
    API_EVENT_LIST : PREFIX + "/jt/serviceEvent/eventList",
    API_QRY_PROMOTION_TYPE : PREFIX + "/jt/qryPromoMemType",//促销券
    API_QRY_PROMOTION_LIST : PREFIX + "/jt/qryPromoMemList",

    API_GENERATE_CODE: PREFIX + "/serialNumbers/",//code
    API_CONTACT_CHANNEL: PREFIX + "/jt/serviceEvent/contactChannel",
    API_BIG_DATA_TRIAL: BIG_DATA_URL + "/cpcpIntf/queryLabel",
    API_BIG_DATA_TRIAL_LIST: BIG_DATA_URL +"/cpcpIntf/queryOrder",
    API_UPLOAD_TFCIDEN_FILE: PREFIX +"/import/trafficIdentifyRule",
    API_GEN_SEQ_BY_TABLENAME: PREFIX +"/common/genSeqByTname",
    API_GEN_RG_SEQ: PREFIX +"/common/genRGSeq",
    API_TI_RULE_DOWNLOAD: PREFIX +"/files/TIRuleDownload",
    API_QRY_TRAFFIC_IDENTIIFY_LIST: PREFIX +"/jt/qryTrafficIdentify",
    API_QRY_TRAFFIC_IDENTIIFY_RULE_LIST: PREFIX +"/jt//qryTrafficIdentifyRuleList",
    API_QRY_MARKET_SYS_DATES: PREFIX +"/getEventSysDates",

    API_COPY_MARKET: PREFIX + "/market/copy",//复制营销活动
    API_MARKET_SUMMARY: PREFIX + "/market/summary",//营销活动统计
    API_UPDATE_STATUS:PREFIX +"/jt/updateStatus",
    API_TAR_GRP: PREFIX + "/tarGrp",//查询分群
    /*------------------销售品自动加载begin---------------------------------*/
    API_STATIS_AOFFER_AUTO_LOD_NUM: PREFIX + "/jt/statisAOfferAutoLoadNum",
    API_STATIS_AOFFER_AVG_AUTO_LOD_TIME: PREFIX + "/jt/statisAOfferAvgLoadTime",
    //1小时内加载完成省份数量趋势
    API_STATIS_FINISH_REGION_WITH1_HOUR: PREFIX + "/jt/statisLoadWith1HourRegions",
    // 销售品加载时长统计
    API_QRY_LOAD_INFO_LIST: PREFIX + "/jt/qryLoadTimeList",
    //单独销售品分省加载时长统计
    API_LOAD_TIME_4REGIONS: PREFIX + "/jt/loadTime4Regions",
    //单独销售品分省加载详情
    API_LOAD_TIME_INFO: PREFIX + "/jt/loadTimeInfo",
    // 查询同一需求单下的销售品列表
    API_LOAD_OFFER_LIST: PREFIX + "/jt/loadOfferList",
    /*------------------销售品自动加载end---------------------------------*/
    /*-----------------------------营销竞争-------------------------------*/
    API_LOAD_MARKETING_COMPETITION: PREFIX + "/marketCompetitionList",
    API_LOAD_UPLOAD_MARKETING_COMPETITION: CURRENT_URL+PREFIX + "/uploadMarketCompetition",
    API_LOAD_GET_STAFF_INFO:PREFIX + "/getStaffInfoBytoken",
    API_LOAD_QUERY_STAFF_INFO:PREFIX + "/findTelNum",
    API_LOAD_SAVE_MARKETING_COMPETITION:PREFIX + "/addMarketCompetition",
    API_LOAD_DOWNLOAD_FILE:WEBPREFIX+PREFIX+"/files/{id}/download",
    /*-----------------------------营销竞争-------------------------------*/
	API_WHITELIST_EXPORT: PREFIX +"/excel/download",//导出白名单

    // 营销反馈
    API_MARKETING_FEEDBACK_LIST: PREFIX + "/marketFeedback/list",
    API_MARKETING_FEEDBACK_DETAIL: PREFIX + "/marketFeedback/detail",
    API_MARKETING_FEEDBACK_DICT: PREFIX + "/marketFeedback/getDictData",
    API_LABEL_CATALOG : PREFIX + "/jt/qryLabelGroup",
    API_LABEL: PREFIX + "/jt/qryLabeInstList",

    API_MARKET_SER_PARAM_LIST: PREFIX + "/market/mktServParam/list",
}

import taskUrls from './urls/taskUrls'
Object.assign(URLS,taskUrls)

export {URLS as default,CURRENT_URL,NODE_SERVER_URL,OPEN_API_SERVER,ENVIRONMENT}
